import { post, put, get, del } from '../utils/request'

// 封装店铺模块
export const shopList = (data) => {
  return post(`/admin/basic/store/getAll`, data)
}
// 二维码列表
export const shopQrcodeList = (param = {}) => {
  return post(`/admin/basic/chain/getAll`, param)
}
// 二维码启用
export const qrcodeEnable = (id) => {
  return put(`/admin/basic/chain/enable/${id}`)
}
export const qrcodeDisable = (id) => {
  return put(`/admin/basic/chain/disable/${id}`)
}
// 封装启用状态
// 启用
export const shopEnable = (id) => {
  return put(`/admin/basic/store/enable/${id}`)
}
// 停用
export const shopDisable = (id) => {
  return put(`/admin/basic/store/disable/${id}`)
}
// 删除店铺
export const shopDel = (id) => {
  return del(`/admin/basic/store/delete/${id}`)
}
// 商家详情
export const shopDetail = (id) => {
  return get(`/admin/basic/store/${id}`)
}
// 新增店铺
export const shopAdd = (data) => {
  return post(`/admin/basic/store/add`, data)
}
// 编辑店铺
export const shopEdit = (data) => {
  return post(`/admin/basic/store/update`, data)
}

// 查询所有省份
export const provinceListAPI = () => {
  return get(`/admin/basic/area/queryList`)
}
// 根据省份查询对应城市或者区域
export const cityListAPI = (parentId) => {
  return get(`/admin/basic/area/${parentId}/children`)
}
// 获取三级城市树
export const cityTreeAPI = () => {
  return get(`/admin/basic/area/tree`)
}
// 根据城市编号查询下边店铺
export const shopListByCityIdAPI = (data) => {
  return post(`/admin/basic/store/getStoreByCity`, data)
}

// 添加新的 API 函数：根据商家ID查询所有店铺
export const allStoresByBusinessAPI = (businessId) => {
  return get(`/allStoresByBusiness/${businessId}`)
}